/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package geometry;

/**
 *
 * @author Daniel Ogburn
 */
public class Vector3D
{
   public double x;
   public double y;
   public double z;
   
    public Vector3D ()
   {
       x = 0;
       y = 0;
       z = 0;
   }
   
   
   public Vector3D (double aX, double aY, double aZ)
   {
       x = aX;
       y = aY;
       z = aZ;
   }
   
   public Vector3D( Point3D source, Point3D end)
   {
       x = end.x - source.x;
       y = end.y - source.y;
       z = end.z - source.z;
   }
   
   
   public double getMagnitude()
   {
       return(Math.sqrt((x*x)+(y*y)+(z*z)));
   }
   
   public Vector3D getUnitVector()
   {
       double aMagnitude = getMagnitude();
       
       return new Vector3D(x/aMagnitude,y/aMagnitude,z/aMagnitude);
       
       
   }
   
   
    
}
